package com.yx.mobpushsdkdemo;

import android.app.Application;
import android.content.Context;
import android.util.Log;

import com.mob.MobSDK;
import com.mob.pushsdk.MobPush;
import com.mob.pushsdk.MobPushCallback;
import com.mob.pushsdk.MobPushCustomMessage;
import com.mob.pushsdk.MobPushNotifyMessage;
import com.mob.pushsdk.MobPushReceiver;

public class APP extends Application {
    private static final String TAG = "aaaaa";

    @Override
    public void onCreate() {
        super.onCreate();
        initMobPush();
    }

    private void initMobPush() {
        MobSDK.submitPolicyGrantResult(true);
        MobPush.setAlias("test");
        MobPushReceiver mobPushReceiver = new MobPushReceiver() {
            @Override
            public void onCustomMessageReceive(Context context, MobPushCustomMessage mobPushCustomMessage) {
                Log.d(TAG, "onCustomMessageReceive: " + mobPushCustomMessage);
            }

            @Override
            public void onNotifyMessageReceive(Context context, MobPushNotifyMessage mobPushNotifyMessage) {
                Log.d(TAG, "onNotifyMessageReceive: " + mobPushNotifyMessage);
            }

            @Override
            public void onNotifyMessageOpenedReceive(Context context, MobPushNotifyMessage mobPushNotifyMessage) {
                Log.d(TAG, "onNotifyMessageOpenedReceive: " + mobPushNotifyMessage);
            }

            @Override
            public void onTagsCallback(Context context, String[] strings, int i, int i1) {
                Log.d(TAG, "onTagsCallback: " + strings);
            }

            @Override
            public void onAliasCallback(Context context, String s, int i, int i1) {
                Log.d(TAG, "onAliasCallback: " + s);
            }
        };
        MobPush.addPushReceiver(mobPushReceiver);
        MobPush.getRegistrationId(new MobPushCallback<String>() {
            @Override
            public void onCallback(String s) {
                Log.d(TAG, "getRegistrationId: " + s);
            }
        });
    }
}
